package Clonable;

public class Test {
    public static void main(String[] args) throws CloneNotSupportedException{//后面的必须写上
        Person person = new Person("张三");
        //通过person这个引用,来克隆一个对象
        Person person1 = (Person) person.clone();//不强转型为Person,返回的就是Object类(父类的方法)
        System.out.println(person1.name);

        System.out.println("修改之前");
        System.out.println(person.m.money);//12.5
        System.out.println(person1.m.money);//12.5
        person1.m.money = 99.99;
        System.out.println("修改之后");
        System.out.println("person:"+person.m.money);//12.5
        System.out.println("person1:"+person1.m.money);//99.99

    }
}
